The present invention relates to a portable machine capable of being driven by a battery, and in particular, to a microcomputer system having a sleep function whereby the operation of sections which are not necessary for an ongoing operation is suspended, thus saving electric power.
Recently, portable personal computers and word processors have been marketed which can be operated anywhere with batteries. In such battery-powered devices, reducing consumed electric power increases operation time. To decrease the consumed electric power, various features have been employed. One of these is a sleep function which saves electric power by suspending the operation of the sections which are not related to the ongoing operation. Compared to the operation speed of a CPU, that of a keyboard, floppy-disc drive, or printer is low. Accordingly, while the CPU and its peripheral circuits await input/output responses from the keyboard, floppy-disc drive, and printer, the clock of the CPU and its peripheral circuits may be suspended, or the speed of the clock may be lowered. Low power consumption is realized by switching the clock of the CPU and its peripheral circuits to the sleep mode. The sleep function takes advantage of the fact that many CPU integrated circuits have a C-MOS structure. A C-MOS IC consumes electric power in proportion to its clock rate.
The operation of a conventional system of the above-mentioned type will now be described. FIG. 6 shows a basic input/output service (BIOS) routine that is part of the operating system of a conventional microprocessor system. A CPU and its peripheral circuits are put in the sleep state until the input/output devices supply input signals to the CPU. In step 60, if an input signal is not supplied from the input/output device, the routine goes to step 61. In step 61, the CPU executes a sleep mode command, to suspend the clock of the CPU and its peripheral circuits. The return from the sleep mode is effected by a hardware-type interrupt. If an input signal is supplied from the input/output device in step 60, or if an interrupt instruction is given from the input/output device, the routine goes to step 62 to perform a data input/output operation.
As shown in FIG. 8(a), the conventional application program waits for the input/output by executing the basic input/output service routine of FIG. 6. However, in recent application programs, other processing is performed at the time of waiting the input from the input/output device, as shown in FIG. 8(b). This operation in the application program requires the provision of a routine in BIOS for checking a response from an input/output device. Such a BIOS status routine is shown in FIG. 7, in which the presence/absence of an input signal from the input/output device is checked. When an input signal is supplied in step 70, a flag is set in step 72. This flag is located at a predetermined internal register of the CPU or work area of a system memory. When an input signal is not supplied from the input/output device, the flag is cleared in step 71.
The application program shown in FIG. 8(b) will now be described. Step 81 examines for a response from the input/output device by performing the status routine of FIG. 7. Step 82 checks the state of the flag. If the flag is cleared, step 83 performs other processing. If the flag is set in step 82, the routine goes to step 84. In step 84, the basic input/output service routine of FIG. 6 is executed.
In the application program of FIG. 8(b), in the absence of the input signal from the input/output device, the flag is cleared in step 71 of FIG. 7. Accordingly, other processing is performed in step 83 of FIG. 8(b). Furthermore, in the presence of the input signal from the input/output device, the flag is set in step 72 of FIG. 7. Accordingly, the basic input/output routine of FIG. 6 is executed in step 84 of FIG. 8(b). Since the presence of an input signal from the input/output device is checked in step 60 of FIG. 6, the routine goes to step 62 to perform the data input/output. The application program of FIG. 8(b) performs the input/output routine of FIG. 6 only when a response is detected. Thus, if the application program shown in FIG. 8(b) is employed, the sleep mode of FIG. 6 cannot be effectively used.